<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <style>
        .outer {
            width: 400px;
            height: 100px;
            background-color: red;
            overflow: scroll;
        }

        .inner {
            width: 200px;
            height: 400px;
            background-color: blue;
            margin: 0 auto;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 键盘按下事件 -->
        <input type="text" @keyup.enter="handlerKeyup">
        <!-- perevnt 阻止事件默认行为 -->
        <!-- once 事件执行一次后进行解绑 事件修饰符可以连用 -->
        <a href="http://www.baidu.com" @click.prevent.once="toJump">百度一下</a>
        <!-- 让事件在事件捕获阶段执行 -->
        <!-- <div class="outer" @click.capture="outer">outer -->
        <!-- 只有当前事件对象为event.target时候执行事件 -->
        <!-- <div class="outer" @click.self="outer">outer -->
        <!-- 滚动行为 立即触发paasive -->
        <div class="outer" @scroll.passive="outer">outer
            <!-- <div class="inner" @click.stop="inner">inner</div> -->
            <div class="inner" @click="inner">inner</div>
        </div>
    </div>
    <script>
        new Vue({
            el: "#app",
            data: {},
            methods: {
                handlerKeyup(evevnt){
                    console.log('按下某些特殊键')
                },
                // 跳转
                toJump(event){
                    console.log('跳转');
                    // evevnt.preventDefault()
                },
                inner(event) {
                    console.log("inner");
                    // event.stopPropagation();
                    console.log(event.target, '触发事件的源目标');
                    console.log(event.currentTarget, '当前事件执行的目标');
                },
                outer() {
                    console.log("outer");
                    for(let i=0;i<101;i++){
                        console.log(i);
                    }
                }
            }
        })
    </script>
</body>

</html>